#pragma once
//Time Control Register

class HighPerformanceTimer
{
public:
	HighPerformanceTimer()
	{
		LARGE_INTEGER frequency = {0};
		::QueryPerformanceFrequency(&frequency);
		m_frequency = frequency.QuadPart;
	}

	inline void Begin()
	{
		LARGE_INTEGER beginCounter = {0};
		::QueryPerformanceCounter(&beginCounter);
		m_beginTick = beginCounter.QuadPart;
	}

	inline void End()
	{
		LARGE_INTEGER endCounter = {0};
		::QueryPerformanceCounter(&endCounter);
		m_endTick = endCounter.QuadPart;
	}

	inline __int64 GetUnitSpan(int unit)
	{
		return (m_endTick-m_beginTick) * unit / m_frequency;
	}

	inline __int64 GetUnitTick(int unit)
	{
		LARGE_INTEGER nowCounter = {0};
		::QueryPerformanceCounter(&nowCounter);
		return nowCounter.QuadPart * unit / m_frequency;
	}
private:
	__int64 m_frequency;
	__int64 m_beginTick;
	__int64 m_endTick;
};
